home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1988 October / Ahoy_Magazine_88-10_1988_Double_L.d64 / Sprite Rotator (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  4KB  |  137 lines

  1. 0 poke52,45:poke56,45:clr
  2. 1 ifpeek(2040)<180thenpoke2040,255
  3. 2 ifpeek(2041)<180thenpoke2041,254
  4. 3 ifpeek(49152)<>76thenload"rot.ml",8,1
  5. 10 poke53280,0:poke53281,0:poke53269,0:poke53248,220:poke53249,100
  6. 15 poke53271,3:poke53277,3
  7. 20 poke53251,100:poke53250,30:print"[147]sprite rotator":poke53264,2
  8. 25 print"designed by john fedor":poke53287,1:poke53288,1:goto120
  9. 30 a=sqr(x^2+y^2):ifx=0thenb=0:goto55
  10. 50 b=atn(y/x):ifsgn(y)=1andsgn(x)=-1thenb=b+(NULL)
  11. 51 ifsgn(y)=-1andsgn(x)=-1thenb=b+(NULL)
  12. 52 ifsgn(x)=-1andy=0thenb=(NULL)
  13. 53 ifsgn(x)=1andy=0thenb=0
  14. 54 goto60
  15. 55 ifsgn(y)=1thenb=(NULL)/2
  16. 56 ifsgn(y)=-1thenb=-(NULL)/2
  17. 60 d1=de*(NULL)/180:y1=int(.5+a*sin(d1+b)):x1=int(.5+a*cos(d1+b)):return
  18. 90 x1=x+11:y1=10-y:q=s1*64+y1*3+int(x1/8):do=peek(q)and(2^(7-(x1and7))):return
  19. 100 ifx1<-11ory1<-10orx1>12ory1>10thenreturn
  20. 105 x2=x1+11:y2=10-y1:q=s2*64+y2*3+int(x2/8)
  21. 110 pokeq,peek(q)or(2^(7-(x2and7))):return
  22. 120 print"1. load in sprites shapes
  23. 125 [153]"2. change source sprite
  24. 130 print"3. change destination sprite
  25. 135 [153]"4. rotate sprite
  26. 140 print"5. animate sprites
  27. 150 [153]"6. save sprites
  28. 152 print"7. touch-up sprite
  29. 153 [153]"8. copy source to destination
  30. 155 s1=peek(2040):s2=peek(2041)
  31. 160 poke198,0
  32. 170 geta$:ifa$<"1"ora$>"8"then170
  33. 175 a=val(a$):onagosub200,250,300,400,500,350,600,1000
  34. 180 run
  35. 200 print"[147]what is the filename (load)
  36. 202 f$[178]"":[133]f$:[139]f$[178]""[167][138]
  37. 203 [159]15,8,15,"i0
  38. 204 input#15,a,b$,c,d:ifathenprinta;b$;c;d:close15:fori=1to5000:next:run
  39. 205 open5,8,5,f$+",p,r
  40. 206 [132]15,a,b$,c,d:[139]a[167][153]a;b$;c;d:[160]15:[129]i[178]1[164]5000:[130]:[138]
  41. 207 [161]#5,a$,b$:[160]5
  42. 208 c$[178][199](0):s1[178][198](a$[170]c$)[170][198](b$[170]c$)[172]256:s1[178]s1[173]64
  43. 209 [151]2040,s1
  44. 210 [147]f$,8,1
  45. 220 [138]
  46. 250 [151]53269,1
  47. 260 [153]"loadcurrent shape:"s1
  48. 265 [153]"use +/- to adjust.  <return> to end.":[151]650,128
  49. 270 [161]a$:[139]a$[178]"+"[167]s1[178]s1[170]1:[139]s1[177]255[167]s1[178]255
  50. 275 [139]a$[178]"-"[167]s1[178]s1[171]1:[139]s1[179]180[167]s1[178]180
  51. 280 [151]2040,s1:[153]""[163]14)s1
  52. 285 [139]a$[179][177][199](13)[167]270
  53. 290 [151]650,0:[138]
  54. 300 [151]53269,2
  55. 310 [153]"loadcurrent shape:"s2
  56. 315 [153]"use +/- to adjust.  <return> to end.":[151]650,128
  57. 320 [161]a$:[139]a$[178]"+"[167]s2[178]s2[170]1:[139]s2[177]255[167]s2[178]255
  58. 325 [139]a$[178]"-"[167]s2[178]s2[171]1:[139]s2[179]180[167]s2[178]180
  59. 330 [151]2041,s2:[153]""[163]14)s2
  60. 335 [139]a$[179][177][199](13)[167]320
  61. 340 [151]650,0:[138]
  62. 350 [139]s1[177]s2[167][153]"not possible":[129]i[178]1[164]5000:[130]:[138]
  63. 353 [153]"loadwhat is the filename (save)"
  64. 354 f$[178]"":[133]f$:[139]f$[178]""[167][138]
  65. 355 [159]15,8,15,"i0":[152]15,"s0:"[170]f$
  66. 356 [159]5,8,5,f$[170]",p,w
  67. 360 a%=(s1*64)/256:b%=(s1*64)-a%*256
  68. 363 print"saving...."
  69. 365 print#5,chr$(b%)chr$(a%);
  70. 370 fori=s1*64tos2*64+63:print#5,chr$(peek(i));:next
  71. 375 close5
  72. 377 input#15,a,b$,c,d:ifathenprinta;b$;c;d:fori=1to5000:next
  73. 378 close15
  74. 380 run
  75. 400 fori=s2*64tos2*64+63:pokei,0:next
  76. 410 poke53269,3
  77. 415 print"[147]what is the rotation (in degrees)";
  78. 420 inputde
  79. 430 print"[147]calculating..."de"degrees":printtab(25)peek(2040)tab(33)peek(2041)
  80. 435 fory=-10to10:forx=-11to12:gosub90:ifdothengosub30:gosub100
  81. 445 next:next:print""tab(14)"done"
  82. 450 forx=1to2000:next:run
  83. 500 print"[147]press +/- to adjust highlighted sprite
  84. 510 [153]"press <return> to switch start/end
  85. 515 print"press f1 to begin.
  86. 520 [151]650,128:[151]53269,3:x[178]1:a1$[178]"":a2$[178]"wait
  87. 522 printa1$"start:[146]"s1:printa2$"end  :[146]"s2
  88. 523 poke2040,s1:poke2041,s2
  89. 525 geta$:ifa$="+"andx=1thens1=s1+1:ifs1>255thens1=255
  90. 526 ifa$="+"andx=2thens2=s2+1:ifs2>255thens2=255
  91. 527 ifa$="-"andx=1thens1=s1-1:ifs1<180thens1=180
  92. 528 ifa$="-"andx=2thens2=s2-1:ifs2<180thens2=180
  93. 530 ifa$=chr$(13)thenx=3-x:b$=a1$:a1$=a2$:a2$=b$
  94. 535 ifa$<>"[133]"then522
  95. 540 print"[147]press +/- to adjust speed
  96. 545 [153]"press <return> to exit
  97. 550 poke53269,1:x=20
  98. 555 fori=s1tos2stepsgn(s2-s1):poke2040,i
  99. 560 forq=1tox:next
  100. 565 geta$:ifa$="+"thenx=x+1
  101. 570 ifa$="-"thenx=x-1:ifx<1thenx=1
  102. 575 ifa$<>chr$(13)thennext:goto555
  103. 580 poke2040,s1:poke650,0:run
  104. 600 print"[147]":poke53269,5
  105. 606 print"f1 - exits  m - mirror"
  106. 607 print"f - flip  i - invert  clr/home - clear
  107. 610 [158]49158:[141]900
  108. 630 ly[178]0:lx[178]0
  109. 635 [151]2042,14
  110. 640 [129]i[178]896[164]959:[151]i,0:[130]
  111. 645 [129]i[178]896[164]913[169]3:[151]i,252:[130]
  112. 650 [151]53289,7:[151]53252,lx[172]8[170]24:[151]53253,ly[172]8[170]82
  113. 655 [161]a$:[139]a$[178]"load"[167][129]i[178]s1[172]64[164]s1[172]64[170]63:[151]i,0:[130]:[141]900:[137]655
  114. 660 [139]a$[178]"input"[167][138]
  115. 665 [139]a$[178]"f"[167]800
  116. 670 [139]a$[178]"m"[167]850
  117. 675 [139]a$[178]"i"[167][129]i[178]s1[172]64[164]s1[172]64[170]63:[151]i,255[171][194](i):[130]:[141]900:[137]655
  118. 680 a[178]15[171][194](56320)[175]15
  119. 685 [139](a[175]1)[167]ly[178]ly[171]1:[139]ly[179]0[167]ly[178]20
  120. 690 [139](a[175]2)[167]ly[178]ly[170]1:[139]ly[177]20[167]ly[178]0
  121. 695 [139](a[175]4)[167]lx[178]lx[171]1:[139]lx[179]0[167]lx[178]23
  122. 700 [139](a[175]8)[167]lx[178]lx[170]1:[139]lx[177]23[167]lx[178]0
  123. 705 [139]([194](56320)[175]16)[167]650
  124. 710 a[178]s1[172]64[170]ly[172]3[170][181](lx[173]8)
  125. 715 b[178]7[171](lx[175]7):[139]([194](a)[175](2[174]b))[167][151]a,[194](a)[175](255[171](2[174]b)):[137]722
  126. 720 [151]a,[194](a)[176](2[174]b)
  127. 722 z[178]lx[170]ly[172]40[170]55296[170]160
  128. 723 a[178][194](z)[175]15:a1[178]1:[139]a1[178]a[167]a1[178]12
  129. 724 [151]z,a1
  130. 725 [137]650
  131. 800 a[178]s1[172]64:[151]252,a[173]256:[151]251,a[171][194](252)[172]256:[158]49152:[141]900
  132. 820 [137]650
  133. 850 a[178]s1[172]64:[151]252,a[173]256:[151]251,a[171][194](252)[172]256:[158]49155:[141]900
  134. 870 [137]650
  135. 900 a[178]s1[172]64:[151]252,a[173]256:[151]251,a[171][194](252)[172]256:[158]49377:[142]
  136. 1000 [129]i[178]0[164]63:[151]s2[172]64[170]i,[194](s1[172]64[170]i):[130]:[138]
  137.